﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WebInstagram.Models;

namespace WebInstagram.DAL
{
    public class LikesRepository : Repository<Like>
    {
        public List<Like> GetPhotoLikes(int ID)
        {
            var likes = Table.Where(l => l.PhotoID == ID).ToList();
            return likes;
        }

        public void DeletePhotoLike(int ID, string user)
        {
            var like = Table.Where(l => l.PhotoID == ID && l.User == user).FirstOrDefault();
            if (like != null)
                Delete(like);
        }
    }
}